$OpenBSD: patch-configure,v 1.4 2012/04/08 12:40:51 pascal Exp $
--- configure.orig	Sun Dec 18 11:03:44 2011
+++ configure	Sun Apr  8 14:36:19 2012
@@ -2698,8 +2698,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline
 host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
 
 # libgcj represents the runtime libraries only used by gcj.
-libgcj="target-libffi \
-	target-zlib \
+libgcj="target-zlib \
 	target-qthreads \
 	target-libjava"
 
@@ -2716,6 +2715,7 @@ target_libraries="target-libgcc \
 		target-libquadmath \
 		target-libgfortran \
 		target-boehm-gc \
+		target-libffi \
 		${libgcj} \
 		target-libobjc \
 		target-libada \
@@ -3049,7 +3049,9 @@ fi
 
 # Save it here so that, even in case of --enable-libgcj, if the Java
 # front-end isn't enabled, we still get libgcj disabled.
-libgcj_saved=$libgcj
+# And with the Java front-end enabled, the variable libgcj_saved will
+# be used in gcc/java/config-lang.in to specify library dependencies.
+libgcj_saved="target-libffi ${libgcj}"
 case $enable_libgcj in
 yes)
   # If we reset it here, it won't get added to noconfigdirs in the
@@ -3060,7 +3062,7 @@ yes)
 no)
   # Make sure we get it printed in the list of not supported target libs.
   # Don't disable libffi, though, other languages use it.
-  noconfigdirs="$noconfigdirs `echo ${libgcj} | sed -e 's/target-libffi//'`"
+  noconfigdirs="$noconfigdirs ${libgcj}"
   # Clear libgcj_saved so that even if java is enabled libffi won't be
   # built.
   libgcj_saved=
